﻿@model PagingDataSet<GroupMember>
@{
    Layout = "manage-2cols";

    Html.ViewContext.RouteData.Values["CurrentNavigationId"] = 13900190;
    var areaCode = ViewData.Get<string>("areaCode", null);   
    GroupEntity group = ViewData.Get<GroupEntity>("group", null);
    bool canSetManager = new Authorizer().Group_SetManager(group);
}
<div class="tn-box tn-widget tn-widget-content tn-corner-all spb-group-members">
    <div class="tn-box-content tn-widget-content tn-corner-all">
        <div class="tn-main-heading tn-border-gray tn-border-bottom">
            <h2>
                成员管理
            </h2>
        </div>
        <div class="tn-tabs">
            <ul class="tn-tabs-nav tn-border-gray tn-border-bottom tn-helper-clearfix">
                <li class="tn-widget-content tn-border-gray tn-border-trl">
                    <a href="@SiteUrls.Instance().ManageMemberApplies(group.GroupKey)">
                        申请处理
                    </a>
                </li>
                <li class="tn-widget-content tn-border-gray tn-border-trl tn-tabs-selected">
                    <a href="@SiteUrls.Instance().ManageMembers(group.GroupKey)">
                        成员管理
                    </a>
                </li>
                <li class="tn-widget-content tn-border-gray tn-border-trl">
                    <a href="@SiteUrls.Instance().ManageChildGroups(group.GroupKey)">
                        子店铺管理
                    </a>
                </li>
            </ul>
            <div class="tn-tabs-panel">
                <div class="tn-list-header">
                    <div class="tn-toolbar-area tn-helper-clearfix">
                        @Html.LinkButton("添加会员", SiteUrls.Instance()._add(Url.SpaceKey()), iconType: IconTypes.Add, htmlAttributes: new { @*plugin = "dialog"*@ })
                        @Html.LinkButton("移除成员", SiteUrls.Instance().BatchRemoveMember(Url.SpaceKey()), iconType: IconTypes.SmallCross, htmlAttributes: new { id = "BatchRemoveMember" })
                        @*@Html.LinkButton("转让商户", SiteUrls.Instance()._ChangeGroupOwner(Url.SpaceKey(), SiteUrls.Instance().GroupHome(Url.SpaceKey())), HighlightStyles.Secondary, htmlAttributes: new { plugin = "dialog" })*@
                    </div>

                        @using (Html.BeginForm("ManageMembers", "GroupSpaceSettings", FormMethod.Get))
{
    <div class="tn-toolbar-area tn-helper-clearfix">
        编号：@Html.DropDownList("userid", new List<SelectListItem>() { new SelectListItem() { Text = "降序", Value = "desc" }, new SelectListItem() { Text = "升序", Value = "asc" } }, new { @class = "tn-dropdownlist" })
        性别：@Html.DropDownList("gener", new List<SelectListItem>() { new SelectListItem() { Text = "男", Value = "男" }, new SelectListItem() { Text = "女", Value = "女" } }, new { @class = "tn-dropdownlist" })
        类型：@Html.DropDownList("Maritaltype", new List<SelectListItem>() { new SelectListItem() { Text = "降序", Value = "desc" }, new SelectListItem() { Text = "升序", Value = "asc" } }, new { @class = "tn-dropdownlist" })
        婚姻状况：@Html.DropDownList("MaritalStatus", new List<SelectListItem>() { new SelectListItem() { Text = "降序", Value = "desc" }, new SelectListItem() { Text = "升序", Value = "asc" } }, new { @class = "tn-dropdownlist" })
        <span class="tn-option">
            @Html.Button("排序", ButtonTypes.Submit, HighlightStyles.Primary)
        </span>
    </div>
}
                    @Html.Partial("_PartialGroupMember", Model)
                </div>
            </div>
        </div>
    </div>
    </div>
    <script language="javascript" type="text/javascript">

        $(document).ready(function () {
            //全选按钮
            $("input#memberIds-checkAll").click(function () {
                checkAll(this, "userIds");
            });
            //设置管理员
            $("a[id^='IsManager-']").click(function () {
                var url = this.href;
                $.post(url, function (data) {
                    art.dialog.tips(data.MessageContent, 1.5, data.MessageType,
                    function () {
                        window.location.reload(true);
                    });
                });
                return false;
            });


            //批量删除
            $("a#BatchRemoveMember").click(function (e) {
                e.preventDefault();
                if (!$("input[name='userIds']:checked").length) {
                    alert("至少选择一位成员操作");
                    return false;
                }

                url = $(this).attr("href");
                art.dialog.confirm('您确认要删除这些成员吗？', function () {
                    $.post(url, $("form#Form-BatchSet").serialize(), function (data) {
                        art.dialog.tips(data.MessageContent, 1.5, data.MessageType,
                        function () {
                            window.location.reload(true);
                        });
                    });
                });
            });


        });

    </script>
